package com.android.aishangauction.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;

import com.android.aishangauction.R;
import com.android.aishangauction.utils.ObjectUtils;
import com.github.chrisbanes.photoview.PhotoView;

/**
 * Created by Administrator on 2017/9/1.
 */

public class ImageDetailFragment extends Fragment {
        private String mImageUrl;
        private PhotoView photoView;
        private ProgressBar progressBar;
               public static ImageDetailFragment newInstance(String imageUrl) {
              final ImageDetailFragment f = new ImageDetailFragment();

                final Bundle args = new Bundle();
               args.putString("url", imageUrl);
                f.setArguments(args);
                return f;
         }
               @Override
        public void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
                mImageUrl = getArguments() != null ? getArguments().getString("url")
                        : null;
           }
    @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View v = inflater.inflate(R.layout.image_detail_fragment, container, false);
        photoView = (PhotoView) v.findViewById(R.id.image);
        photoView.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                getActivity().finish();
            }
        });
        ObjectUtils.photo2(getActivity(),mImageUrl,photoView);
//        // 启用图片缩放功能


        return v;
    }



    }
